package com.firefightingiot.firefightingiot.web.web;

import cn.hutool.json.JSONObject;
import com.firefightingiot.firefightingiot.common.base.BaseController;
import com.firefightingiot.firefightingiot.support.annotaion.Action;
import com.firefightingiot.firefightingiot.support.annotaion.At;
import com.firefightingiot.firefightingiot.support.model.RespEntity;
import com.firefightingiot.firefightingiot.web.service.VideoStreamService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

/**
 * @Author: YangYu
 * @ClassName: VideoStreamController
 * @Date: Created in 14:06 2022/5/27
 * @Description: 视频流控制器
 */
@Action
@RequestMapping(value = "video")
public class VideoStreamController extends BaseController {
    @Resource
    private VideoStreamService videoStreamService;

    /**
     * 获取视频直播流
     *
     * @param jsonParam
     * @return
     */
    @At(value = "getLiveStream", method = RequestMethod.GET, param = {"number"})
    public RespEntity getLiveStream(@RequestBody(required = false) JSONObject jsonParam) {
        return videoStreamService.getLiveStream(jsonParam);
    }

    /**
     * 获取视频回放流
     *
     * @param jsonParam
     * @return
     */
    @At(value = "getPlaybackStream", method = RequestMethod.GET, param = {"number","beginTime","endTime"})
    public RespEntity getPlaybackStream(@RequestBody(required = false) JSONObject jsonParam) {
        return videoStreamService.getPlaybackStream(jsonParam);
    }
}
